const state = {
  id: "" || sessionStorage.getItem("infoID"),
  title: "" || sessionStorage.getItem("infoTitle")
};
const getters = {
  infoID: state => state.id,
  infoTitle: state => state.title
};
const mutations = { // 必须 同步没有回调处理
  /*SET_ID(state, value) {
      state.id = value;
      sessionStorage.setItem('infoID', value);
  },
  SET_TITLE(state, value) {
      state.title = value;
      sessionStorage.setItem('infoTitle', value);
  },*/
  // 更新 state ****
  UPDATA_STATE_VALUE(state, params) {
    for (let key in params) {
      // 存储值
      state[key] = params[key].value;
      // 是否存储值
      if (params[key].session) {
        sessionStorage.setItem(params[key].sessionKey, params[key].value);
      }
    }
  }

};
const actions = { // 可以有回调

};
export default {
  namespaced: true, // 解决命名空间问题
  state,
  getters,
  mutations,
  actions
};
